﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ADEVSO.Data;
using ADEVSO.Util;

namespace SmartParking.Web
{
    public partial class Terms : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                (Master as Template).Title = "Términos y Condiciones";
                System.Text.StringBuilder text = new System.Text.StringBuilder();
                ADEVSO.Collections.ArrayList file = ADEVSO.IO.File.GetFileLines(Request.MapPath("media/doc/SmartParking - Terms and Conditions.txt"));
                for (int i = 0; i < file.Count; i++)
                    text.AppendLine(file[i].ToString());
                tboxTerms.Text = text.ToString();
                SetControlsStatus();
            }            
        }

        private void SetControlsStatus()
        {
            bool visible = Request.UrlReferrer.ToString().EndsWith("reservations.aspx");
            imgSteps.Visible = visible;
            chboxTerms.Visible = visible;
            cmdBack.Visible = visible;
            cmdForward.Visible = visible;
            cmdForward.Enabled = chboxTerms.Checked;            
        }
        
        protected void chboxTerms_CheckedChanged(object sender, EventArgs e)
        {
            cmdForward.Enabled = chboxTerms.Checked; 
        }
    }
}